using System;
using System.Collections.Generic;
using UnityEngine;

public class APF_StrayAnimals : MonoBehaviour
{
	public List<Transform> sprites;

	public float speed = 2f;

	public float width = 3f;

	public float height = 2f;

	public float followDelay = 0.2f;

	private float timeOffset;

	private List<float> spriteOffsets;

	private void Start()
	{
		timeOffset = Random.Range(0f, MathF.PI * 2f);
		spriteOffsets = new List<float>();
		for (int i = 0; i < sprites.Count; i++)
		{
			spriteOffsets.Add((float)i * followDelay);
		}
	}

	private void Update()
	{
		MoveSprites();
	}

	private void MoveSprites()
	{
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = default(Vector3);
		for (int i = 0; i < sprites.Count; i++)
		{
			if ((Object)(object)sprites[i] != (Object)null)
			{
				float num = Time.time * speed + timeOffset - spriteOffsets[i];
				float num2 = Mathf.Cos(num) * width;
				float num3 = Mathf.Sin(num) * height;
				((Vector3)(ref val))._002Ector(num2, num3, sprites[i].position.z);
				float num4 = (0f - Mathf.Sin(num)) * width;
				Mathf.Cos(num);
				_ = height;
				sprites[i].position = ((Component)this).transform.position + val;
				bool flipX = num4 < 0f;
				((Component)sprites[i]).GetComponentInChildren<SpriteRenderer>().flipX = flipX;
			}
		}
	}
}
